#include "user.h"

using namespace aviation;

User::User()
{
	m_hashedPassword = 0;
	m_adminRights = false;
}

User::User(const User& other)
{
	*this = other;
}

User::User(const String userName, const String passWord, const bool adminRights)
	: 
m_userName(userName), 
m_adminRights(adminRights)
{
	m_hashedPassword = util::HashString(passWord + m_userName);
}

User::~User()
{

}

User& User::operator=(const User& other)
{
	m_userName = other.m_userName;
	m_hashedPassword = other.m_hashedPassword;
	m_adminRights = other.m_adminRights;
	return *this;
}

const bool User::operator==(const User& other) const
{
	return m_userName == other.m_userName;
}

const bool User::operator<(const User& other) const
{
	return m_userName < other.m_userName;
}

const User::String User::GetUsername() const
{
	return m_userName;
}

const bool User::IsAdmin() const
{
	return m_adminRights;
}

const unsigned User::GetHashedPassword() const
{
	return m_hashedPassword;
}